<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateFavoritesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('favorites', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('member_id')->index()->comment('用户ID');
            $table->integer('article_id')->index()->default('0')->nullable()->comment('文章ID');
            $table->integer('article_comment_id')->index()->default('0')->nullable()->comment('文章评论ID');
            $table->integer('topic_id')->index()->default('0')->nullable()->comment('帖子ID');
            $table->integer('topic_comment_id')->index()->default('0')->nullable()->comment('帖子评论ID');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('favorites');
    }
}
